﻿//Erwin Guerra mamani

app.factory("UsuarioServices", function ($http) {


    var bUrl = "http://localhost:15640/api";
    return {

        getListByFilter: function () {

            return $http.get(bUrl + "usuario").then(function (r) {

                return r;
            });

        },

        create: function (data) { // recibe un json

            return $http.post(bUrl + "usuario",data).then(function (r) {

                return r;
            });

        },

        delete: function (id) { // recibe un json

            return $http.delete(bUrl + "usuario", { params: id }).then(function (r) {

                return r;
            });

        },

        update: function (idx, data) {

            return $http({

                method: "PUT",
                url: bUrl + "usuario/" + data.id,
                data: data,
            }).then(function (r) {

                return r;
            });

        },


    }

});